<?php
defined('IN_ADMIN') or exit('No permission resources.');
include $this->admin_tpl('header','admin');
?>
<form name="searchform" action="?m=ushop&c=orders&a=back_list&menuid=<?php echo $_GET['menuid'];?>" method="post"  style="margin:10px auto; width:99%;">
<table width="100%" cellspacing="0" class="search-form">
    <tbody>
		<tr>
		<td>
        <div class="explain-col" style="text-align:left;">
			<?php echo L('订单号')?>:<input type="text" value="" class="input-text" name="search[order_number]">
            退贷时间: <?php echo form::date('search[start_time]','','')?><?php echo L('to')?> <?php echo form::date('search[end_time]','','')?> 
            <input type="submit" value="<?php echo L('search')?>" class="button" name="dosubmit">
		</div>
		</td>
		</tr>
    </tbody>
</table>
</form>
<form action="?m=ushop&c=orders&a=back_sale_order&menuid=<?php echo $_GET['menuid'];?>" method="post" id="sale_form">
<div class="table-list" style="width:99%; margin:auto;">
<table width="100%" cellspacing="0">
	<thead>
		<tr>
        	<th width="4%" align="center"><input type="checkbox" value="" id="check_box" onclick=""></th>
			<th width="11%" align="center">订单号&nbsp;
                <a href="javascript:alse_sort('order_sn','desc')"><img src="<?php echo IMG_PATH ;?>admin_img/sort_desc.gif" /></a>&nbsp;
                <a href="javascript:alse_sort('order_sn','asc')"><img src="<?php echo IMG_PATH ;?>admin_img/sort_asc.gif" /></a>
            </th>
			<th width="18%" align="center">下单时间&nbsp;
                <a href="javascript:alse_sort('shipping_time','desc')"><img src="<?php echo IMG_PATH ;?>admin_img/sort_desc.gif" /></a>&nbsp;
                <a href="javascript:alse_sort('shipping_time','asc')"><img src="<?php echo IMG_PATH ;?>admin_img/sort_asc.gif" /></a>
            </th>
            <input type="hidden" name="search_order" value="" id="search_order" />
            <input type="hidden" name="infos" value="<?php echo $where; ?>" />
			<th width="18%" align="center">退贷时间&nbsp;
            	<a href="javascript:alse_sort('back_time','desc')"><img src="<?php echo IMG_PATH ;?>admin_img/sort_desc.gif" /></a>&nbsp;
                <a href="javascript:alse_sort('back_time','asc')"><img src="<?php echo IMG_PATH ;?>admin_img/sort_asc.gif" /></a>
            </th>
            <th width="11%" align="center">收货人</th>
            <th width="11%" align="center">申请人</th>
            <th width="11%" align="center">处理状态</th>
            <th width="15%" align="center">操作</th>
		</tr>
	</thead>
<tbody>
<?php
if(is_array($infos) && !empty($infos)){
	foreach($infos as $info){
?>
	<tr>
		<td align="center"><input type="checkbox" name="back_id[]" value="<?php echo $info['back_id']?>"></td>
        <td align="center"><?php echo $info['order_sn'];?></td>
		<td align="center"><?php echo date('Y-m-d h:i:s',$info['shipping_time']);?></td>
        <td align="center"><?php echo date('Y-m-d h:i:s',$info['back_time']);?></td>
		<td align="center"><?php echo $info['consignee_name'];?></td>
        <td align="center"><?php echo $info['applicant_name'] ?></td>
        <td align="center">
        <?php if($info['back_status']==0) { ?>
        	<span style="color:red">未处理</span>
        <?php }else{ ?>
        	<span style="color:red">已处理</span>
        <?php }?>
        </td>
        <td align="center">
        <a href="index.php?m=ushop&c=orders&a=look_back_sale&back_id=<?php echo $info['back_id']; ?>&menuid=<?php echo $_GET['menuid'];?>">查看</a>
        <a href="index.php?m=ushop&c=orders&a=back_sale_del&back_id=<?php echo $info['back_id']; ?>">删除</a>
        </td>
	</tr>
	<?php
	}
} elseif(empty($infos)) {
?>
	<tr>
    	<td colspan="9" align="center">暂时还没有数据</td>
    </tr>
<?php
}
?>
</tbody>
</table>
</div>
<div class="btn">
    <a href="#" onClick="javascript:$('input[type=checkbox]').attr('checked', true)"><?php echo L('selected_all')?></a>/
    <a href="#" onClick="javascript:$('input[type=checkbox]').attr('checked', false)"><?php echo L('cancel')?></a>
    <input name="dosubmit" type="submit" class="button" value="删除选中" onclick="return confirm('<?php echo L('confirm', array('message' => L('selected')))?>');">&nbsp;&nbsp;
</div>
<div id="pages"><?php echo $pages?></div>
</form>
<script>
	$("input[value='删除选中']").live('mousedown',function() {
		document.getElementById("sale_form").action = "?m=ushop&c=orders&a=back_sale_del";
	})
	function alse_sort(sort_by,sort_order) {
		document.getElementById('search_order').value = sort_by+'&'+sort_order;
		document.getElementById('sale_form').submit();
	}
</script>
</body>
</html>